import Vue from 'vue'
import Router from 'vue-router'
const Home = () => import(/* webpackChunkName: "home" */'view/home') // 打包后命名为“home”的写法：/* webpackChunkName: "home" */
const Login = () => import(/* webpackChunkName: "login" */'view/login')
const Register = () => import(/* webpackChunkName: "register" */'view/register')
const Custom = resolve => require.ensure([], () => resolve(require('view/custom/custom')), 'custom')

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      alias: '/index',
      name: '',
      component: Home
    },
    {
      path: '*',
      redirect: Home
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/register',
      name: 'register',
      component: Register
    },
    {
      path: '/custom',
      name: 'custom',
      component: Custom
    }
  ]
})
